/**
 * ClassName: Java05_Object
 * Package: PACKAGE_NAME
 * DESCRIPTION:冒泡排序
 *
 * @Author 程翎钥
 * @Create 2024/3/30 10:35
 * @Version 1.0
 */
public class Java05_Object {
    public static void main(String[] args) {
        int[] arr = {5,4,3,2,1};
        for(int i=0;i<arr.length-1;i++)
        {
            int flag=1;
            for(int j=0;j<arr.length-1-i;j++)
            {
                int n1=arr[j];
                int n2=arr[j+1];
                if(n1>n2){
                    arr[j]=n2;
                    arr[j+1]=n1;
                    flag=0;
                }
            }
            if(flag == 1)
                break;
        }
        for (int i : arr) {
            System.out.print(i+" ");
        }
    }
}
